package com.wteam.dragon.system.apps.generator.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wteam.dragon.system.apps.generator.pojo.bean.ColumnInfo;
import com.wteam.dragon.system.apps.generator.pojo.dto.ColumnInfoDto;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author 陈晓辉
 * @Date 2021/5/28 16:18
 */
public interface ColumnInfoMapper extends BaseMapper<ColumnInfo> {

    @Select("select column_name, is_nullable, data_type, column_comment, column_key, extra from information_schema.columns " +
            "where table_name = #{tableName} and table_schema = (select database()) order by ordinal_position")
    List<ColumnInfoDto> listColumns(String tableName);
}
